<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <title>一指赢易购</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0" />
    <link type="text/css" href="http://localhost:8899/getplan_4TEjId/WebApp/Home/View/Public/baofeng/css/public.css" rel="stylesheet" />
    <script src="http://localhost:8899/getplan_4TEjId./Public/plugins/jQuery/jquery-2.2.3.min.js"></script>
    <script src="http://localhost:8899/getplan_4TEjId/WebApp/Home/View/Public/baofeng/js/public.js?v=80"></script>
    <style>
        * {
            padding: 0;
            margin: 0;
            list-style: none;
            border: 0;
        }
        html {
            background-color: #fff;
            color: #333333;
            height:100%;
            font-size:12px;
            font-family: Arial,Helvetica,"微软雅黑","华文细黑",sans-serif;
        }
        em, i {
            font-style: normal;
        }
        button, input, optgroup, option, select, textarea {
            font-family: inherit;
            font-size: inherit;
            font-style: inherit;
            font-weight: inherit;
            outline: 0;
        }
        a, button, input {
            -webkit-tap-highlight-color: rgba(255,0,0,0);
        }
        p {
            margin:0px;
            padding:0px;
        }
        .boxflex > * {
            display: block;
        }
        .box_flex_1 {
            -moz-box-flex: 1;
            box-flex: 1;
            -moz-flex: 1;
            -webkit-flex: 1;
            flex: 1;
            -webkit-box-flex: 1;
        }
        .android_activity {
            height:100%;
        }
        .register-box {
            width: 100%;
            min-height: 100%;
            background-color: #fff;
            padding: 20px 10px;
            box-sizing: border-box;
        }
        .boxflex {
            display: box !important;
            display: -moz-box !important;
            display: -o-box !important;
            display: -ms-box !important;
            display: -webkit-flex !important;
            display: -moz-flex !important;
            display: -o-flex !important;
            display: flex !important;
            display: -webkit-box !important;
        }
        .input-wrap {
            height: 40px;
            border: 1px solid #e6e6e6;
            border-radius: 4px;
            margin-bottom: 15px;
        }
        .input-wrap input {
            height: 100%;
            line-height: 40px\9;
            padding: 0 10px;
            width: 100%;
            box-sizing: border-box;
        }
        i.icon {
            display: inline-block;
            width: 40px;
            height: 40px;
            margin-top:0px;
            background: url(http://localhost:8899/getplan_4TEjId/WebApp/Home/View/Public/baofeng/img/icon2.png) no-repeat;
            background-size: 100%;
        }
        i.icon.icon-tel {
            background-position: -33px -4px;
            background-size: 450%;
        }
        i.icon.icon-name {
            background-position: 0 -4px;
            background-size: 450%;
        }
        i.icon.icon-pwd {
            background-position: -102px -4px;
            background-size: 450%;
        }
        .input-wrap i.icon {
            background-color: #dcdcdc;
        }

        #errorMsg {
            padding: 10px 0;
            line-height: 30px;
            height: 30px;
            color: #d82f2f;
        }
        .yebz_but {
            height: 40px;
            line-height: 40px;
            border: 0;
            background-color: #58abeb;
            font-size: 13px;
            width:100%;
            color: #FFF;
            cursor:pointer;
            border-radius: 4px;
            -webkit-border-radius: 4px;
            -moz-border-radius: 4px;
            -ms-border-radius: 4px;
            -o-border-radius: 4px;
            text-align: center;
            display: block;
        }
        .yebz_but {
            margin-top: 5px;
        }
        .sms_but {
            background-color: #58abeb;
            color: #FFF;
            padding:0 15px;
            cursor:pointer;
            width: 110px;
            border-radius: 0 4px 4px 0;
            -webkit-border-radius: 0 4px 4px 0;
            -moz-border-radius: 0 4px 4px 0;
            -ms-border-radius: 0 4px 4px 0;
            -o-border-radius: 0 4px 4px 0;
            border-left:1px solid #e6e6e6;
        }
        .sms_but:disabled {
            background-color: #fcfcfc;
            color: #b6b6b6;
        }
    </style>
</head>
<body>
<div class="android_activity">
    <div class="register-box">
        <span style="width:100%;text-align:center;display:block;font-size:16px;color:#666666;margin: 15px 0 55px;">用户登录</span>
        <div class="input-wrap boxflex">
            <input type="tel" id="mobile_phone" placeholder="请输入您的手机号码" maxlength="11" class="box_flex_1 register-tel">
            <button class="sms_but" id="btnSendCode" time="120" onclick="SendMsg('l')">获取验证码</button>
        </div>
        <div class="input-wrap boxflex">
            <input type="tel" id="sms_code" placeholder="请输入6位短信验证码" maxlength="6" class="box_flex_1 register-tel">
        </div>
        <p id="errorMsg"></p>
        <button id="yebz_but" class="yebz_but">提交</button>
    </div>
</div>
<script>
	var timer1 = null;
    var isSub = true;
    $(function () {
        $("#yebz_but").on('click', function () {
            $("#errorMsg").html("");
            if ($("#mobile_phone").val() == "") {
                $("#errorMsg").html("请输入您的手机号码");
                return;
            }

            $("#errorMsg").html("");
            if ($("#sms_code").val() == "") {
                $("#errorMsg").html("请输入6位短信验证码");
                return;
            }

            if (isSub == true) {
                isSub = false;
                loadshow();
                $("#yebz_but").addClass("disable");
                $.post("http://localhost:8899/getplan_4TEjId/user/sub_login", { mobile_phone:$("#mobile_phone").val(), sms_code:$("#sms_code").val() }, function(result) {
                    $("#yebz_but").removeClass("disable");
                    loadhide();
                    isSub = true;
                    $("#errorMsg").html(result.msg);
                    if (result.code == 1) {
						location.href = "http://localhost:8899/getplan_4TEjId/index";
                        // window.location.reload();
                    }
                });
            }
        });
    });
	
	function SendMsg(type) {
		$("#errorMsg").html("");
		var phone = $("#mobile_phone").val();
		if (phone.trim() == "") {
			$("#errorMsg").html("请输入手机号码！");
			return;
		}
		if ($("#btnSendCode").attr("disabled") != "disabled") {
			$("#btnSendCode").attr('disabled', 'disabled');
			loadshow();
			$.post("http://localhost:8899/getplan_4TEjId/user/sendSMS", {type: type, mobile_phone: phone}, function(result) {
				loadhide();
				if(result.success == 0)
				{
					$("#errorMsg").html("验证码已发送，请注意查收！");
					timer1 = setInterval(function() {SetRemainTime();},1000);
				}
				else
				{
					$("#btnSendCode").removeAttr("disabled");
					$("#errorMsg").html(result.msg);
				}
			});
		}
	}
	
	function SetRemainTime() {
		$("#btnSendCode").attr("disabled", "disabled");
		var time = $("#btnSendCode").attr("time");
		time = time - 1;
		$("#btnSendCode").attr("time", time);
		$("#btnSendCode").html(time + "秒");
		if (time == 0) {
			$("#btnSendCode").removeAttr("disabled");
			$("#btnSendCode").html("发送验证码");
			$("#btnSendCode").attr("time", 120);
			clearInterval(timer1);
		}
	}
</script>
</body>
</html>